<div id="idForm">
	<form id="form_<?= $form->getAssign () ?>" action="" method="post">
		<input type="hidden" name="itemId" value="<?= $itemId ?>" />
		<?
		$notLoadables = array ();
		
		while ($group = $form->getGroup ())
		{
			ob_start ();
			
			try
			{
				?>
				<table align="center" border="0" width="100%" cellpadding="2" cellspacing="0">
					<?
					$backColor = 'FFFFFF';
					while ($field = $form->getField (FALSE, $group->getId ()))
					{
						if (!$field->isLoadable ())
						{
							$notLoadables [] = $field;
							
							continue;
						}
						
						$backColor = $backColor == 'FFFFFF' ? 'F4F4F4' : 'FFFFFF';
						$label = Form::toLabel ($field, TRUE);

						?>
						<tr id="row_<?= $field->getAssign () ?>" height="18px" style="background-color: #<?= $backColor ?>;">
							<td width="20%" nowrap style="text-align: right;"><b><?= trim ($label) == '&nbsp;' ? '&nbsp;' : $label .':' ?></b></td>
							<td><?= Form::toForm ($field) ?></td>
							<td width="20px" style="vertical-align: top;"><?= Form::toHelp ($field); ?></td>
						</tr>
						<tr height="2px"><td></td></tr>
						<?
					}
					?>
				</table>
				<?
				$output = ob_get_clean ();
			}
			catch (Exception $e)
			{
				ob_end_clean ();
				
				throw new Exception ($e->getMessage ());
			}
			catch (PDOException $e)
			{
				ob_end_clean ();
				
				throw new PDOException ($e->getMessage ());
			}
			
			if ($group->getId ())
			{
				?>
				<fieldset id="group_<?= $group->getId () ?>" class="<?= $group->isVisible () ? 'formGroup' : 'formGroupCollapse' ?>">
					<legend onclick="JavaScript: showGroup (<?= $group->getId () ?>); return false;">
						<?= $group->getLabel () ?>
					</legend>
					<div>
						<?= $output ?>
					</div>
				</fieldset>
				<?
			}
			else
				echo $output;
		}
		?>
	</form>
	
	<table align="center" border="0" width="100%" cellpadding="2" cellspacing="0">
		<?
		foreach ($notLoadables as $trash => $field)
		{
			$backColor = $backColor == 'FFFFFF' ? 'F4F4F4' : 'FFFFFF';
			$label = Form::toLabel ($field, TRUE);
			?>
			<tr id="row_<?= $field->getAssign () ?>" height="18px" style="background-color: #<?= $backColor ?>;">
				<td nowrap style="text-align: left;"><b><?= trim ($label) == '&nbsp;' ? '&nbsp;' : $label .':' ?></b></td>
				<td width="20px" style="vertical-align: top;"><?= Form::toHelp ($field); ?></td>
			</tr>
			<tr>
				<td colspan="2"><?= Form::toForm ($field) ?></td>
			</tr>
			<tr height="2px"><td></td></tr>
			<?
		}
		?>
	</table>
</div>
<script type="text/javascript">
try
{
	
	$('field__MONEY_VALUE_').onkeyup = function()
	{
		var calc = this.value.replace ('.', '');
		calc = parseFloat(calc.replace (',', '.'));
		
		var pay = $('field__VALUE_').value.replace ('.', '');
		pay = parseFloat(pay.replace (',', '.'));
		
		$('field__RETURN_VALUE_').value = moeda.formatar((isNaN(calc - pay)?0:calc - pay));
	}
}
catch (e){}
</script>